package cn.edu.scnu.controller;
import cn.edu.scnu.entity.MovieStats;
import cn.edu.scnu.service.MovieStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * echarts 中文api 图表展现
 */
@RestController
@RequestMapping("/chart-data")
public class ChartDataController {

    @Autowired
    private MovieStatsService movieStatsService;

    @GetMapping("/weekly-views")
    public List<MovieStats> getWeeklyViewsData() {
        return movieStatsService.getWeeklyViewsData();
    }

    @GetMapping("/monthly-views")
    public List<MovieStats> getMonthlyViewsData() {
        return movieStatsService.getMonthlyViewsData();
    }
}